package top.amot.forceview.drawitem

import android.content.Context
import android.graphics.Canvas
import android.graphics.PointF
import top.amot.forceview.model.AbstractNode
import top.amot.forceview.theme.I_Theme

abstract class AbstractDrawItem<T : AbstractNode>(val context: Context) {

    abstract fun isType(node: AbstractNode): Boolean

    abstract fun measure(node: T)

    fun draw(canvas: Canvas, theme: I_Theme, node: AbstractNode, isSelectNode: Boolean){
        drawItem(canvas,theme, node as T,isSelectNode)
    }

    abstract fun drawItem(canvas: Canvas, theme: I_Theme, node: T, isSelectNode: Boolean)

    abstract fun calcLinkPoint(node: T,position:LinkPointPosition): PointF

    abstract fun containPoint(node: T, x: Float, y: Float):Boolean
}

enum class LinkPointPosition{
    TOP,BOTTOM,LEFT,RIGHT
}